﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="save" Then
	call save
else
	call index
end if
end Function



Function index
dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim id


    		id = Request("id")    
    		If id = "" Then id = 0
   		If Not IsNumeric(id) Then id = 0
    		id = CLng(id)
    		If id < 0 Then id = 0

	dim rs,sql,Runtxt,tp
	Runtxt=qingtian.RunStr

			set rs=server.CreateObject("adodb.recordset")
			sql="select top 1 * from qingtian_bbs where id="&id
			rs.open sql,conn,1,1
			if not (rs.bof and rs.eof) then
if Request.QueryString("tp")="" then
tp=rs("logo")
else
tp=Request.QueryString("tp")
end if

%>
	<card title="修改论坛"><p align="left">
	论坛名称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>" maxlength="50" value="<%=rs("name")%>" type="text"/><br/>
	论坛LOGO：(可空)<a href='wenjian.asp?url=editfbbsclass.asp?Page=<%=Page%>@id=<%=id%>&amp;sid=<%=sid%>'>上传图片</a><br/>
	<input emptyok="true"  name="logo<%=Runtxt%>" maxlength="50" value="<%=tp%>" type="text"/><br/>
	论坛排序：<br/>
	<input emptyok="true"  name="px<%=Runtxt%>" format="*N" value="<%=rs("pid")%>" type="text"/><br/>
	版主论坛:<br/>
	<select name="bbs<%=Runtxt%>" value="<%=rs("bbs")%>">
	<option value="false">不是版主论坛</option>
	<option value="true">版主论坛</option>
	</select><br/>
	<anchor>确定提交
    	<go href="editfbbsclass.asp?id=<%=id%>&amp;Action=save&amp;page=<%=page%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="px" value="$(px<%=Runtxt%>)"/>
        <postfield name="logo" value="$(logo<%=Runtxt%>)"/>
        <postfield name="bbs" value="$(bbs<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>
<%else%>
暂无论坛分类！<br/>
<%end if%>
-------------<br/>
<a href='fbbsclass.asp?page=<%=page%>&amp;sid=<%=sid%>'>返回论坛分类管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
			Rs.close
			set rs=nothing
End Function




Function save
dim page,name,px,logo,bbs,rs,sql,errs
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim id


    		id = Request("id")    
    		If id = "" Then id = 0
   		If Not IsNumeric(id) Then id = 0
    		id = CLng(id)
    		If id < 0 Then id = 0
		name=Request.form("name")
		px=Request.form("px")
		logo=Request.form("logo")
		bbs=Request.form("bbs")
		errs=""
		if name="" then errs=errs & "论坛名称不能为空<br/>"
		if px="" then errs=errs & "论坛排序不能为空<br/>"
		if Not IsNumeric(px) then errs=errs & "论坛排序必需为数字<br/>"
		if bbs="" then errs=errs & "版主论坛不能为空<br/>"





	IF len(errs)=0 then


		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select  * FROM qingtian_bbs where id="&id
		rs.open sql,conn,1,3
			rs("name")=name
			rs("pid")=px
			rs("br")=true
			rs("logo")=logo
			rs("bbs")=bbs
			rs("class")=false
			rs("view")=0
		rs.update()
		rs.Close
		Set rs = Nothing
	%>
	<card id="save" title="修改论坛" ontimer="fbbsclass.asp?page=<%=page%>&amp;sid=<%=sid%>"><timer value="20"/>
		<p align="left">
		修改论坛成功!<br/><%

	else%>

	<card id="save" title="修改论坛" ontimer="editfbbsclass.asp?id=<%=id%>&amp;page=<%=page%>&amp;sid=<%=sid%>"><timer value="20"/>
		<p align="left">
		<%=errs%>
		<a href="editfbbsclass.asp?id=<%=id%>&amp;page=<%=page%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='fbbsclass.asp?page=<%=page%>&amp;sid=<%=sid%>'>返回论坛分类管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 



%>
